
import Vuex from 'vuex'
import Vue from 'vue'
import user from './user'
import comment from './comment'
import banDialog from './banDialog'
import userApi from '@/axios/userApi'
Vue.use(Vuex)
const store = new Vuex.Store({
    state: {
        isLoginDialog: false,
        //弹出回复输入框的所在评论id
        commentInputCid: '',
    },
    mutations: {
        popLoginDialog(state) {
            ;
            state.isLoginDialog = true
        },
        closeLoginDialog(state) {
            state.isLoginDialog = false
        },
        changeCommentInput(state, cid) {
            state.commentInputCid = cid
        }
    }
    ,
    modules: {
        user: user,
        comment,
        banDialog,
    },
})

const userInfoStr = window.localStorage.getItem('userInfo');
if (userInfoStr)
    store.commit("user/login", JSON.parse(userInfoStr))

export default store